package csa_test

import (
	th "git.sr.ht/~mil/mobroute/src/csa_test/csa_testhelper"
	"git.sr.ht/~mil/mobroute/src/db"
)

var csaTestCaseMultitransExplicit = CSATestCase{
	Test: "multitrans_explicit: Handles multiple transfers accounting for transfer costs",
	Args: CSAArgs{
		Connections: th.ReorderByDepartureTime([]db.Connection{
			{ConnID: "1_0", TripID: "1", FromSSIDU: "a", ToSSIDU: "b", FromST: 3, ToST: 10},
			{ConnID: "1_1", TripID: "1", FromSSIDU: "b", ToSSIDU: "c", FromST: 10, ToST: 20},

			{ConnID: "2_0", TripID: "2", FromSSIDU: "a", ToSSIDU: "d", FromST: 0, ToST: 1},
			{ConnID: "2_1", TripID: "2", FromSSIDU: "d", ToSSIDU: "e", FromST: 1, ToST: 2},
			{ConnID: "2_2", TripID: "2", FromSSIDU: "e", ToSSIDU: "f", FromST: 3, ToST: 4},
			{ConnID: "2_3", TripID: "2", FromSSIDU: "f", ToSSIDU: "c", FromST: 5, ToST: 6},

			{ConnID: "3_0", TripID: "3", FromSSIDU: "g", ToSSIDU: "h", FromST: 10, ToST: 12},
			{ConnID: "3_1", TripID: "3", FromSSIDU: "h", ToSSIDU: "f", FromST: 12, ToST: 16},

			{ConnID: "4_0", TripID: "4", FromSSIDU: "g", ToSSIDU: "h", FromST: 12, ToST: 13},
			{ConnID: "4_1", TripID: "4", FromSSIDU: "h", ToSSIDU: "f", FromST: 17, ToST: 20},

			{ConnID: "5_0", TripID: "5", FromSSIDU: "g", ToSSIDU: "f", FromST: 18, ToST: 19},

			{ConnID: "6_0", TripID: "6", FromSSIDU: "f", ToSSIDU: "i", FromST: 22, ToST: 24},
			{ConnID: "6_1", TripID: "6", FromSSIDU: "i", ToSSIDU: "j", FromST: 24, ToST: 30},
		}),
		Transfers: &[]db.Transfer{
			{FromSSIDU: "f", ToSSIDU: "f", TransferTime: 0},
			{FromSSIDU: "b", ToSSIDU: "g", TransferTime: 1},
			{FromSSIDU: "g", ToSSIDU: "i", TransferTime: 20},

			{FromSSIDU: "b", ToSSIDU: "b", TransferTime: 0},
			{FromSSIDU: "j", ToSSIDU: "j", TransferTime: 0},
			{FromSSIDU: "g", ToSSIDU: "g", TransferTime: 0},
		},
		WalkcostsOrigin: map[string]uint{
			"a": 0, "b": 999, "c": 999, "d": 999, "e": 999, "f": 999, "g": 999, "h": 999, "i": 999, "j": 999,
		},
		FromTime:                1,
		ImplicitTransferSeconds: 2,
		MaxTransferSeconds:      14,
		MaxNTransfers:           99,
	},
	Expect: map[string]CSATestArrivalDetails{
		"a": {1, "", 0},
		"b": {10, "1_0", 1},
		"c": {20, "1_1", 1},
		"d": {1000, "", 0},
		"e": {1000, "", 0},
		"f": {19, "5_0", 2},
		"g": {11, "1_0", 1},
		"h": {13, "4_0", 2},
		"i": {24, "6_0", 3},
		"j": {30, "6_1", 3},
	},
}
